<?php

require_once("globals.inc");
require_once("functions.inc");
/* $Id$ */


/* NOTICE ACKNOWLEDGE CODE by Erik Kristensen */
if ($_REQUEST['noticeaction'] == 'acknowledge') {
	$notice_id = $_REQUEST['noticeid'];
	close_notice($notice_id);
}
/**********************************************/

$top_menu_descr = array(
            'system' => '系统信息',
            'network' => '网络设置',
            'firewall' => '防火墙设置',
            'nat' => 'NAT设置',
            'traffic' => '流量管理',
            'webproxy' => 'WEB代理',
            'captiveportal' => '认证门户',
            'service' => '其他服务',
            'tool' => '系统工具',
            );            
            
$top_menu['system']['/index.php'] = '基本信息';   
$top_menu['system']['/dashboard.php'] = '运行状态';
$top_menu['system']['/general_setup.php'] = '一般设置';
$top_menu['system']['/diag_logs.php'] = '系统日志';
$top_menu['system']['/index.php?logout'] = '登出';

if (!isset($config['system']['webgui']['noassigninterfaces']))
    $top_menu['network']['/interfaces_assign.php'] = '接口分配';
$opts = get_configured_interface_with_descr(false, true);
foreach ($opts as $oif => $odescr)
    if (!isset($config['interfaces'][$oif]['ovpn']))
        $top_menu['network']["/interfaces.php?if={$oif}"] = htmlspecialchars($odescr).'设置';
$top_menu['network']['/interfaces_bridge.php'] = '桥模式';
$top_menu['network']['/multiwan.php'] = '多WAN设置';
$top_menu['network']['/firewall_virtual_ip.php'] = '虚拟IP';
$top_menu['network']['/interfaces_vlan.php'] = 'VLAN设置';
$top_menu['network']['/services_dhcp.php'] = 'DHCP服务设置';
$top_menu['network']['/services_dnsmasq.php'] = 'DNS转发';
$top_menu['network']['/diag_routes.php'] = '路由表';
$top_menu['network']['/system_routes.php'] = '静态路由';

$top_menu['firewall']['/firewall_aliases.php'] = '别名管理';
$top_menu['firewall']['/firewall_rules.php'] = '规则管理';
$top_menu['firewall']['/firewall_mac.php'] = 'MAC过滤';
$top_menu['firewall']['/firewall_software.php'] = '软件过滤';
$top_menu['firewall']['/firewall_arp.php'] = 'ARP告警';
$top_menu['firewall']['/pkg_edit.php?xml=snort.xml&id=0'] = '入侵检测';

$top_menu['nat']['/firewall_nat.php'] = '端口转发';
$top_menu['nat']['/firewall_nat_1to1.php'] = '1:1 NAT'; 
$top_menu['nat']['/firewall_nat_out.php'] = 'NAT规则';  

$top_menu['traffic']['/status_graph.php'] = '接口实时流量';
$top_menu['traffic']['/status_rrd_graph.php'] = '接口历史流量';
$top_menu['traffic']['/traffic_monitor.php'] = '流量监控';
$top_menu['traffic']['/traffic_limit.php'] = '流量限制';

$top_menu['webproxy']['/pkg_edit.php?xml=squid.xml&id=0'] = '基本设置';
$top_menu['webproxy']['/pkg_edit.php?xml=squid_upstream.xml&id=0'] = '代理设置'; 
$top_menu['webproxy']['/pkg_edit.php?xml=squid_cache.xml&id=0'] = '缓存管理'; 
$top_menu['webproxy']['/squid_nac.php'] = '访问控制'; 
$top_menu['webproxy']['/pkg_edit.php?xml=squid_traffic.xml&id=0'] = '流量管理'; 
$top_menu['webproxy']['/squid_history.php'] = '上网记录'; 

$top_menu['captiveportal']['/services_captiveportal.php'] = '基本设置';
$top_menu['captiveportal']['/services_captiveportal_user.php'] = '在线用户';
$top_menu['captiveportal']['/services_captiveportal_mac.php'] = '免认证MAC'; 
$top_menu['captiveportal']['/services_captiveportal_ip.php'] = '免认证IP';
$top_menu['captiveportal']['/services_captiveportal_template.php'] = '模板管理';
$top_menu['captiveportal']['/services_captiveportal_filemanager.php'] = '文件管理';
$top_menu['captiveportal']['/system_usermanager.php'] = '用户管理';

$top_menu['service']['/status_services.php'] = '服务状态';
$top_menu['service']['/pkg_edit.php?xml=miniupnpd.xml&id=0'] = 'UPnP';
$top_menu['service']['/vpn_pptp.php'] = 'PPTP VPN';
$top_menu['service']['/services_snmp.php'] = 'SNMP';
$top_menu['service']['/services_arpwatch.php'] = 'ARP监控';
$top_menu['service']['/pkg_edit.php?xml=openntpd.xml&id=0'] = 'OpenNTPD';

$top_menu['tool']['/client_list.php'] = '局域网用户';
$top_menu['tool']['/diag_arp.php'] = 'ARP缓存表';
$top_menu['tool']['/diag_dump_states.php'] = '状态表';
$top_menu['tool']['/diag_system_pftop.php'] = '连接活动';
$top_menu['tool']['/diag_system_activity.php'] = '系统活动';
$top_menu['tool']['/status_filter_reload.php'] = '防火墙状态';
$top_menu['tool']['/diag_ping.php'] = 'Ping';
$top_menu['tool']['/diag_traceroute.php'] = 'Traceroute';
$top_menu['tool']['/diag_packet_capture.php'] = '抓包';
//$top_menu['tool']['/exec.php'] = '命令行工具';
$top_menu['tool']['/edit.php'] = '文件编辑';
$top_menu['tool']['/diag_backup.php'] = '备份/恢复';
$top_menu['tool']['/diag_defaults.php'] = '缺省设置';
$top_menu['tool']['/reboot.php'] = '重启';
$top_menu['tool']['/halt.php'] = '关机';

if($_SERVER['REQUEST_URI'] == '/')
    $_SERVER['REQUEST_URI'] = '/index.php';

$lv1_curr = '';
$lv2_curr = '';
if(isset($pgmenu))
{
    $lv1_curr = $pgmenu[0];
    $lv2_curr = $pgmenu[1];
}
else
{
    foreach($top_menu as $lv1 => $lv2)
    {
        if(isset($lv2[$_SERVER['REQUEST_URI']]))
        {
            $lv1_curr = $lv1;
            $lv2_curr = $_SERVER['REQUEST_URI'];
            break;
        }
    }
}

?>

<div id="soft_whole_div">
    <div id="soft_head">
        <div class="soft_head_left fl"></div>
        <div class="soft_head_right fr"></div>
            <div class="soft_logo fl"></div>
            <div class="soft_head_nav fl">
                <ul>
                <?php 
                    foreach($top_menu_descr as $name => $descr)
                    {
                        $class = $name == $lv1_curr ? 'class="curs"' : '';
                        foreach($top_menu[$name] as $key => $value)
                        {
                            $href = $key;
                            break;
                        }
                        echo "<li $class><a href='$href'>$descr</a></li>";
                    }
                ?>
                </ul>
            </div>
            
            
    </div>
    <div class="clear"></div>
    <div id="soft_content">
       
      <div id="soft_cont_left" class="fl">
                <div class="soft_title">
                    <h1 class="soft_title_h1"><?=$top_menu_descr[$lv1_curr];?></h1>
                    <ul class="soft_title_ul">
                    <?php 
                        foreach($top_menu[$lv1_curr] as $key => $value)
                        {
                            $class = $key == $lv2_curr ? 'class="title_li"' : '';
                            echo "<li $class><a href='$key'>$value</a></li>";
                        }
                    ?>
                    </ul>
                </div>
            </div>
        <div id="soft_cont_right">

<?php
function output_menu_item($url, $name) {
	//if (isAllowedPage($url))
		echo "<li><a href=\"{$url}\" class=\"navlnk\">{$name}</a></li>\n";
}
	
?>



<?php
	$pgtitle_output = true;
?>
